//
//  UIView+HYExtension.m
//  (First By Myself)
//
//  Created by Ezra on 16/5/27.
//  Copyright © 2016年 Ezra. All rights reserved.
//

#import "UIView+HYExtension.h"

@implementation UIView (HYExtension)

- (CGSize)HY_size
{
    return self.frame.size;
}
-(void)setHY_size:(CGSize)HY_size
{
    CGRect frame = self.frame;
    frame.size = HY_size;
    self.frame = frame;
}

-(CGFloat)HY_x
{
    return self.frame.origin.x;
}
-(void)setHY_x:(CGFloat)HY_x
{
    CGRect frame = self.frame;
    frame.origin.x = HY_x;
    self.frame = frame;
}
-(CGFloat)HY_y
{
    return self.frame.origin.y;
}
-(void)setHY_y:(CGFloat)HY_y
{
    CGRect frame = self.frame;
    frame.origin.y = HY_y;
    self.frame = frame;
}
-(CGFloat)HY_width
{
    return self.frame.size.width;
}
-(void)setHY_width:(CGFloat)HY_width
{
    CGRect frame = self.frame;
    frame.size.width = HY_width;
    self.frame = frame;
}
-(CGFloat)HY_height
{
    return self.frame.size.height;
}
-(void)setHY_height:(CGFloat)HY_height
{
    CGRect frame = self.frame;
    frame.size.height = HY_height;
    self.frame = frame;
}


-(CGFloat)HY_centerX
{
    return self.center.x;
}
-(void)setHY_centerX:(CGFloat)HY_centerX
{
    CGPoint center = self.center;
    center.x = HY_centerX;
    self.center = center;
}
-(CGFloat)HY_centerY
{
    return self.center.y;
}
-(void)setHY_centerY:(CGFloat)HY_centerY
{
    CGPoint center = self.center;
    center.y = HY_centerY;
    self.center = center;
}


-(CGFloat)HY_maxX
{
    return CGRectGetMaxX(self.frame);
}
-(void)setHY_maxX:(CGFloat)HY_maxX
{
    self.HY_x = HY_maxX - self.HY_width;
}
-(CGFloat)HY_maxY
{
    return CGRectGetMaxY(self.frame);
}
-(void)setHY_maxY:(CGFloat)HY_maxY
{
    self.HY_x = HY_maxY - self.HY_height;
}

@end
